package main.java.com.chankudo.proxy;
/**
 * 静态代理示例
 * 传入目标对象，与目标对象实现相同的接口。
 * 在接口中的定义的函数内调用目标对象前后，做一些其他的行为。
 */
public class StaticPersonProxy implements IPerson{
    private IPerson person;
    
    public StaticPersonProxy(IPerson person) {
        this.person = person;
    }

    @Override
    public void eat() {
        System.out.println("before peron eat, do something....");
        person.eat();
        System.out.println("after peron eat, do something....");
    }

    @Override
    public void say(String words) {
        System.out.println("before peron say, do something....");
        person.eat();
        System.out.println("after peron say, do something....");
    }
    
}
